package edu.nf.project.services.storeOperation.impl;

import edu.nf.project.entitys.entity.other.dto.CustomerOrderInfoDTO;
import edu.nf.project.mappers.storeOperation.convention.CustomerOrderDTOMapper;
import edu.nf.project.services.storeOperation.CustomerOrderDTOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author gjh
 * @Date 2025/6/4
 * @Description:
 */
@Service
public class CustomerOrderDTOServiceImpl implements CustomerOrderDTOService {
    @Autowired
    private CustomerOrderDTOMapper customerOrderDTOMapper;

    @Override
    public List<CustomerOrderInfoDTO> getOrderByOrderUId(String u_id) {
        return customerOrderDTOMapper.getOrderByOrderUId(u_id);
    }

    @Override
    public CustomerOrderInfoDTO getOrderById(String orderId) {
        List<CustomerOrderInfoDTO> orderById = customerOrderDTOMapper.listOrderById(orderId);
        Optional<CustomerOrderInfoDTO> first = orderById.stream().findFirst();
        return first.get();
    }
}
